<?php include_once __DIR__.'/left.html';?>
<div class="layui-body">
  <!-- 内容主体区域 -->
  <div style="padding: 15px;">
    <blockquote class="layui-elem-quote">一旦设置成功, 每天会自动同步您的选品库</blockquote>
    <div class="layui-tab">
      <ul class="layui-tab-title">
        <li class="layui-this">设置</li>
        <li>申请说明</li>
        <li>微信扫码查看</li>
      </ul>
      <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
          <form class="layui-form" action="<?=url('admin/apply')?>">
            <div class="layui-form-item">
              <label class="layui-form-label">App Key</label>
              <div class="layui-input-block">
                <input type="text" name="tbk_app_key" value="<?=$userinfo['tbk_app_key']?>" required lay-verify="required" placeholder="请输入App Key" autocomplete="off" class="layui-input">
              </div>
            </div>
            <div class="layui-form-item">
              <label class="layui-form-label">App Secret</label>
              <div class="layui-input-block">
                <input type="text" name="tbk_app_secret" value="<?=$userinfo['tbk_app_secret']?>" required lay-verify="required" placeholder="请输入App Secret" autocomplete="off" class="layui-input">
              </div>
            </div>
            <div class="layui-form-item">
              <label class="layui-form-label">导购ID</label>
              <div class="layui-input-block">
                <input type="text" name="tbk_adzone_id" value="<?=$userinfo['tbk_adzone_id']?>" required lay-verify="required" placeholder="请输入导购ID" autocomplete="off" class="layui-input">
              </div>
            </div>
            <div class="layui-form-item">
              <label class="layui-form-label">我的选品库</label>
              <div class="layui-input-block">
                <?php foreach($xpk as $k=>$v):?>
                  <input type="checkbox" disabled=true required lay-verify="required" value="<?=$v['favorites_id']?>" title="<?=$v['favorites_title']?>">
                <?php endforeach;?>
              </div>
            </div>
            <div class="layui-form-item">
              <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="myform">立即提交</button>
              </div>
            </div>
          </form>
        </div>
        <div class="layui-tab-item">
          1. 您先得有阿里妈妈账号, <a>参考淘客客教程</a>
          <br> 2. 登录<a target="_blank" href="https://pub.alimama.com/myunion.htm#!/manage/site/site">阿里妈妈</a>后台>管理推广资源>媒体管理>网站管理>新增网站推广(填备案号:渝ICP备16007876号-1)
          <br> 3. 新增广告会有一个文件下载, 你把这个文件下载下来
          <br> 4. 上传文件
          <br>
          <button type="button" class="layui-btn layui-btn-danger" id="test7"><i class="layui-icon"></i>上传验证文件</button>
          <br> 5. 到阿里妈妈确认完成,并申请API权限
          <br> 6. 设置APPkey
        </div>
        <div class="layui-tab-item">
            <img src="<?=$img_url?>" />
        </div>
      </div>
    </div>
  </div>
</div>
<script>
  layui.use(['element', 'upload'], function() {
    var $ = layui.jquery,
      upload = layui.upload,
      element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
    //设定文件大小限制
    upload.render({
      elem: '#test7',
      url: "<?=url('admin/upfile')?>",
      size: 60,
      exts: 'txt',
      done: function(res) {
        layer.msg('已上传root文件');
      }
    });

    //同步数据
    function tongbu(rs){

    }
  });
</script>
